package com.ccb.sc.common.modules.shopkeeper.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author ken
 * @version 1.0
 * @date 2020-09-25
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@Getter
public enum ShopkeeperLevel implements IEnum<Integer> {

    /**
     * 店主等级：0普通会员 1优秀店主 2卓越店主 3合伙人
     */
    ORDINARY_MEMBER(0, "普通会员"),

    EXCELLENT_SHOPKEEPER(1, "优秀店主"),

    BRILLIANT_SHOPKEEPER(2, "卓越店主"),

    PARTNER(3, "合伙人"),

    HEADS(4, "团长"),

    ;

    private final int value;
    private final String desc;

    ShopkeeperLevel(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static ShopkeeperLevel getByValue(int value) {
        for (ShopkeeperLevel orderStatus : ShopkeeperLevel.values()) {
            if (value == orderStatus.getValue()) {
                return orderStatus;
            }
        }
        return null;
    }
}
